package com.example.iot.queue;

import com.example.iot.queue.message.RuleEngineQueueMsg;
import com.example.iot.queue.message.ProtoQueueMsg;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;

/**
 * @author ChenXiangpeng
 */
@Service
public class QueueProducerContext {
    private final QueueFactory queueFactory;

    private QueueProducer<ProtoQueueMsg<RuleEngineQueueMsg>> toRuleEngine;

    public QueueProducerContext(QueueFactory queueFactory) {
        this.queueFactory = queueFactory;
    }

    @PostConstruct
    public void init() {
        this.toRuleEngine = queueFactory.createRuleEngineProducer();
    }

    public QueueProducer<ProtoQueueMsg<RuleEngineQueueMsg>> getRuleEngineProducer() {
        return toRuleEngine;
    }
}
